package com.gu.redisdemo.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.Gu
 * @date 2020/9/29 16:25
 * @function :
 **/
@Service
public class RedisDemo {

    @Autowired
    RedisTemplate<String,String> redisTemplate;

    /**
     * 向redis中保存字符串数据
     */
    public void saveRedis() {
        redisTemplate.opsForValue().set("key","value");
    }

    public void getRedis() {
        String key = redisTemplate.opsForValue().get("key");
        System.out.println(key);
    }

    public void abc() {
        System.out.println("这是在主分支上的开发代码");
        System.out.println("我是测试分支，我不信");
        System.out.println("我就是主分支，不信拉倒");
    }

}
